home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / overview / ooptesample / udocument.p < prev    next >
Encoding:
Text File  |  2000-09-28  |  3.8 KB  |  127 lines

  1. {---------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware Simple TextEdit Sample Application
  6. #
  7. #    OOPTESample
  8. #
  9. #    UDocument.p        -    Pascal Source
  10. #
  11. #    Copyright © 1988, 1989 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:        
  15. #                    1.00                    04/89
  16. #                    1.10                    02/90
  17. #                    1.11                    10/92
  18. #
  19. #    Components:     
  20. #                    BuildOOPTESample            February 1, 1990
  21. #                    MTESample.p                    February 1, 1990
  22. #                    OOPTESample.make            February 1, 1990
  23. #                    TECommon.h                    February 1, 1990
  24. #                    TESampleGlue.a                February 1, 1990
  25. #                    TESample.r                    February 1, 1990
  26. #                    TMLRules.make                February 1, 1990
  27. #                    UApplication.p                February 1, 1990
  28. #                    UApplication.inc1.p            February 1, 1990
  29. #                    UDocument.p                    February 1, 1990
  30. #                    UDocument.inc1.p            February 1, 1990
  31. #                    UTEDocument.p                February 1, 1990
  32. #                    UTEDocument.inc1.p            February 1, 1990
  33. #                    UTESample.p                    February 1, 1990
  34. #                    UTESample.inc1.p            February 1, 1990
  35. #
  36. ---------------------------------------------------------------------}
  37.  
  38. UNIT UDocument;
  39.  
  40. INTERFACE
  41.  
  42. USES
  43.     Types, QuickDraw, Events, Menus, Devices, ToolUtils, OSUtils, Controls,
  44.     TextEdit, Traps, Windows, Dialogs, 
  45.     ObjIntf;
  46.  
  47. TYPE
  48.     TDocument = OBJECT(TObject)
  49.         fDocWindow: WindowPtr;
  50.         
  51.         PROCEDURE TDocument.IDocument(resID: integer);
  52.         PROCEDURE TDocument.Free; OVERRIDE;
  53.         
  54.         { You will need to override these in your subclasses, since they }
  55.         { do nothing by default. }
  56.         PROCEDURE TDocument.DoZoom(partCode: integer);
  57.         PROCEDURE TDocument.DoGrow(theEvent: EventRecord);
  58.         PROCEDURE TDocument.DoContent(theEvent: EventRecord);
  59.         PROCEDURE TDocument.DoKeyDown(theEvent: EventRecord);
  60.         PROCEDURE TDocument.DoActivate(becomingActive: Boolean);
  61.         PROCEDURE TDocument.DoUpdate;
  62.         
  63.         { File Handling Routines }
  64.         PROCEDURE TDocument.DoOpen;
  65.         PROCEDURE TDocument.DoClose;    { By default, we just delete ourself. }
  66.         PROCEDURE TDocument.DoSave;
  67.         PROCEDURE TDocument.DoSaveAs;
  68.         PROCEDURE TDocument.DoRevert;
  69.         PROCEDURE TDocument.DoPrint;
  70.         
  71.         { Standard Edit Menu actions }
  72.         PROCEDURE TDocument.DoUndo;
  73.         PROCEDURE TDocument.DoCut;
  74.         PROCEDURE TDocument.DoCopy;
  75.         PROCEDURE TDocument.DoPaste;
  76.         PROCEDURE TDocument.DoClear;
  77.         PROCEDURE TDocument.DoSelectAll;
  78.         
  79.         { Idle Time routines: you can use these to do cursor handling, }
  80.         { TE caret blinking, marquee effects, etc. }
  81.         PROCEDURE TDocument.DoIdle;
  82.         FUNCTION TDocument.CalcIdle:Longint;
  83.         PROCEDURE TDocument.AdjustCursor(where: Point); { where is in local coords. }
  84.  
  85.         { Query state of document - useful for adjusting menu state }
  86.         FUNCTION TDocument.HaveUndo: Boolean;
  87.         FUNCTION TDocument.HaveSelection: Boolean;
  88.         FUNCTION TDocument.HavePaste: Boolean;
  89.         FUNCTION TDocument.CanClose: Boolean;
  90.         FUNCTION TDocument.CanSave: Boolean;
  91.         FUNCTION TDocument.CanSaveAs: Boolean;
  92.         FUNCTION TDocument.CanRevert: Boolean;
  93.         FUNCTION TDocument.CanPrint: Boolean;
  94.         
  95.         { Utility routine to get window pointer for document }
  96.         FUNCTION TDocument.GetDocWindow: WindowPtr;
  97.     END;
  98.         
  99.         
  100.     TDocumentLink = OBJECT(TObject)
  101.         fNext: TDocumentLink;
  102.         fDoc: TDocument;
  103.         
  104.         PROCEDURE TDocumentLink.IDocumentLink(n:TDocumentLink; v:TDocument);
  105.         FUNCTION TDocumentLink.GetNext:TDocumentLink;
  106.         FUNCTION TDocumentLink.GetDoc: TDocument;
  107.         PROCEDURE TDocumentLink.SetNext(aLink:TDocumentLink);
  108.         PROCEDURE TDocumentLink.SetDoc(aDoc:TDocument);
  109.     END;
  110.  
  111.     TDocumentList = OBJECT(TObject)
  112.         fDocList: TDocumentLink;    { the first link in our list }
  113.         fNumDocs: integer;            { the number of elements in the list }
  114.         
  115.         PROCEDURE TDocumentList.IDocumentList;
  116.         PROCEDURE TDocumentList.AddDoc(doc:TDocument);
  117.         PROCEDURE TDocumentList.RemoveDoc(doc:TDocument);
  118.         FUNCTION TDocumentList.FindDoc(window:WindowPtr): TDocument;
  119.         FUNCTION TDocumentList.NumDocs:integer;
  120.     END;
  121.         
  122. IMPLEMENTATION
  123.  
  124. {$I UDocument.inc1.p}
  125.  
  126. END.
  127.